//
//  GLBadgeLabel.h
//  KTools
//
//  Created by 121 on 2017/9/22.
//  Copyright © 2017年 杭州吉利控股信息中心. All rights reserved.
//

#import <UIKit/UIKit.h>

@class GLBadgeLabel;

@interface GLBadgeCenter : NSObject
+(instancetype)defaultCenter;

-(void)registerObserver:(GLBadgeLabel*)label forKeyPath:(NSString*)keypath;
-(void)removeObserver:(GLBadgeLabel*)label forKeyPath:(NSString*)keypath;

-(void)setValue:(NSUInteger)value forKeyPath:(NSString*)keyPath;
-(NSUInteger)valueForKeyPath:(NSString*)keyPath;


@end




@interface GLBadgeLabel : UILabel

@property (nonatomic, strong) NSString* bindKeyPath;

@property (nonatomic, assign) UIEdgeInsets edgeInsets;
@property (nonatomic, assign) CGFloat cornerRadius;


@end

@interface UIView (GLBadgeLabel)

/*
 @description 默认为nil，需调用show方法后有值
 */
@property(nonatomic,strong)GLBadgeLabel* badgeLabel;


-(GLBadgeLabel*)showBadge:(NSString*)badgeStr center:(CGPoint)center badgeColor:(UIColor*)color;

-(GLBadgeLabel*)showBadgeBindKeyPath:(NSString*)keyPath center:(CGPoint)center badgeColor:(UIColor*)color;


-(void)hideBadge;

@end
